//
//  HYOUBaseScrollView.m
//  BestGift
//
//  Created by 温晓宇 on 16/1/9.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HYOUBaseScrollView.h"

@implementation HYOUBaseScrollView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
        
        NSString *states = [[NSUserDefaults standardUserDefaults] objectForKey:@"night"];
        if ([states isEqualToString:@"yes"]) {
            self.backgroundColor = NIGHT_COLOR;
        }
    }
    return self;
}
-(void)changeColor:(NSNotification *)notification{

    UIColor *color = [notification object];
    self.backgroundColor = color;
}
@end
